package cn.iocoder.yudao.module.promotion.groupon.pojo.vo;

import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.business.basic.annotation.AdminJsonView;
import cn.iocoder.yudao.framework.business.basic.annotation.AppJsonView;
import cn.iocoder.yudao.framework.business.order.pojo.vo.BizOrderVO;
import cn.iocoder.yudao.module.api.promotion.gift.dto.GiftActivityVO;
import cn.iocoder.yudao.module.api.promotion.groupon.dto.GrouponPackageRespDTO;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * 视图对象
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/05/14
 */
@Data
public class GrouponOrderVO extends BizOrderVO {

    @Schema(description = "类型，从主营类目编码得来，如：food-餐饮美食")
    @JsonView({AdminJsonView.class, AppJsonView.class})
    private String type;

    @Schema(description = "店铺编号")
    @JsonView({AdminJsonView.class, AppJsonView.class})
    private Long shopId;

    @Schema(description = "套餐编号")
    @JsonView({AdminJsonView.class, AppJsonView.class})
    private Long packageId;

    @Schema(description = "套餐信息")
    private GrouponPackageRespDTO packageInfo;

    @SuppressWarnings("unused")
    public GrouponPackageRespDTO getPackageInfo() {
        if (JSONUtil.isTypeJSON(getSnapshot())) {
            return JSONUtil.toBean(getSnapshot(), GrouponPackageRespDTO.class);
        }
        return packageInfo;
    }

    @Schema(description = "赠品活动编号集")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private List<Long> giftActivityIds;

    @Schema(description = "赠品活动信息")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private List<GiftActivityVO> giftActivities;

}
